package com.vencent.spring.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.vencent.spring.service.Repertory;

/**
 * 你可以使用 @Component + @RequestMapping 来代替  @Controller。
 * @author 1d
 *
 */
@Controller
public class HomeController {
	@Autowired
	private Repertory rep;
	
	@RequestMapping("/my/home")
	public String home(){
		return rep.select();
	}
	
	/**
	 * PathVariable 面向资源
	 * @param name
	 * @return
	 */
	@RequestMapping("/my/own/{name}")
	public String own(@PathVariable String name){
		return name;
	}
}
